1. Field of the Invention
The present invention relates generally to computer software development tools and more particularly to a method and system for debugging a Java application that includes native method dynamic load libraries (e.g., C or C++ code).
2. Description of the Related Art
Traditional programming methodologies are organized around actions and logic. Programs developed using traditional software design methodologies are usually easily represented by flow diagrams and could be viewed as a procedure of steps which receive input, processes the data, and produces output.
Object Oriented Programming (xe2x80x9cOOPxe2x80x9d), however, is organized around objects and data. OOP approaches programming from a perspective centralized on providing objects, each object having an interface through which it may be used or by other programs and objects to perform a xe2x80x9cmethodxe2x80x9d or set of methods.
One of the earliest object-oriented computer languages was Smalltalk[(trademark)]. More recent and perhaps more widely used object-oriented languages are C++ and Java.
The Java programming language is especially adapted for use in distributed applications, such as on corporate networks and the Internet. Additionally, Java applications have found extensive use on the World Wide Web.
Java developers often xe2x80x9cextendxe2x80x9d a Java application by linking their own Java code with native method dynamic load libraries (xe2x80x9cDLLxe2x80x9d). A xe2x80x9cnative methodxe2x80x9d DLL is usually a function written in another programming language, such as xe2x80x9cCxe2x80x9d or xe2x80x9cC++xe2x80x9d, which is not portable across different operating platforms without recompilation.
When the Java application includes linked native method DLL""s, a problem arises in debugging the application. In particular, while xe2x80x9ctoolsxe2x80x9d for debugging Java code, on the one hand, and tools for debugging C/C++ code, on the other hand, are well-known, the art lacked the ability to simultaneously debug a piece of software that included both types of code.
As a result, some available methods addressed the problem of debugging Java applications having linked native method DLL""s by using a xe2x80x9cbrute forcexe2x80x9d approach by using distinct debug routines that are run separately. This approach required the Java application with the linked native language DLL""s to be executed twice, one for each debug routine, thereby substantially increasing the time necessary to debug the Java application.
The system and method disclosed in U.S. Pat. No. 5,901,315 to Edwards, et al., provided a solution to this problem at the time of its availability and in keeping with currently available companion Java development tools. This system and method provided for debugging a target application which comprised Java code having linked native method DLL""s which was carried out in a computer having an operating system, a system debug application programming interface (xe2x80x9cAPIxe2x80x9d), and a Java virtual machine (xe2x80x9cJVMxe2x80x9d) having a Java debug API.
According to the Edwards system and method, the JVM was first launched under the system debug API, and the Java application was then run under the JVM. Because the JVM that runs the target application itself runs under the system debug API, simultaneous control of the target application via the system debug API and the Java debug API was enabled. Thus, the method allowed the debug of the target application by simultaneously debugging the Java code and the native method dynamic load libraries. Events generated during the debug process were characterized as being initiated from the Java code or the native method DLL""s, as the case may be. The preferred embodiment of the Edwards debugger comprised a graphical user interface (xe2x80x9cGUIxe2x80x9d) front end, a debug engine back end, and a xe2x80x9cprobexe2x80x9d or daemon. The GUI provided an interface through which the user made requests and viewed the status of the application being debugged. The debug engine performed the debugging work by controlling the probe to manipulate the target application through the JVM, and to report events to the debug engine.
The probe was preferably implemented as two distinct processes, a first xe2x80x9cdaemonxe2x80x9d process that performed native method debugging, and a second xe2x80x9cprobexe2x80x9d process that performed the Java method debugging. The first process also preferably controlled the second process across the system debug API and communicated therewith via a socket connection to facilitate the simultaneous debugging of the Java and C/C++ code comprising the target application.
According to another feature of the Edwards method, the front and back end components of the debugger were supported on a first computer, while the first and second xe2x80x9cprocessesxe2x80x9d were supported on a second computer. The first and second computers could then be connected over a computer network such as a TCP/IP connection to facilitate remote debugging of the target application. The Edwards system and method was implemented in a programming tool product from International Business Machines (xe2x80x9cIBMxe2x80x9d) under the name Interactive Code Analysis Tool (xe2x80x9cICATxe2x80x9d).
The current ICAT for Java utilizes a GUI to permit source-level debugging of Java applications on Microsoft""s Windows[(trademark)] NT 4.0 and Windows2000. Using ICAT, application developers can set breakpoints, execute and step their applications, and examine the application""s stack and variables all with the click of a mouse. If desired, the debugger can be operated remotely; that is, ICAT resides on one system, and the probe resides on the system containing the application. Communication between the two systems is via a TCP/IP connection. The ICAT probe is written in Java, and it interacts with the JVM as needed to control the application being debugged. Essentially, ICAT starts a Windows process, which is the JVM running the probe. ICAT then communicates with the probe via TCP/IP. If ICAT is being run remotely, a daemon is run on the target system which interacts with the probe.
For versions of the JVM before version 1.3, the ICAT probe utilized Sun Microsystems"" sun.tools.debug Application Programming Interface (xe2x80x9cAPIxe2x80x9d) in order to control the application being debugged. The sun.tools.debug API is easy to use, but it is missing a number of functions that the ICAT customarily provided for other debuggers for other programming languages.
Beginning with version 1.3 of the JVM, several new debugger interfaces were provided. Further, support for the sun.tools.debug API was no longer supported. The new Sun product is called the xe2x80x9cJava Platform Debugger Architecturexe2x80x9d (xe2x80x9cJPDAxe2x80x9d), and it has three components:
(1) the Java Virtual Machine Debugging Interface (xe2x80x9cJVMDIxe2x80x9d), which is a low-level native interface which defines what support a JVM must provide in order to allow an application to be debugged;
(2) the Java Debug Wire Protocol (JDWP), which allows communication between a debugger virtual machine and a target virtual machine; and
(3) the Java Debug Interface (JDI), which is a high-level interface, which uses JDWP and JVMDI.
New JPDA features include the ability to exclude classes while stepping modify Java variables, use deferred breakpoints, create watchpoints, display thread names, attach to running processes, and set breakpoints at arbitrary bytecode addresses. JPDA also allows for capturing output from applications for display by the debugger and permits sending input from the debugger to applications. Further, JPDA is believed to be more stable than the sun.tools.debug API.
There are some known disadvantages to using JPDA. Many functions that the probe performs are more complicated to implement with JPDA, especially exception filtering. Also, the ICAT function which allows users to load classes is not officially supported in JPDA.
In as much as the existing ICAT does not support JPDA, and whereas JPDA provides improved functionality and stability for Java application program development, testing, and debugging, there is a need in the art for a system and method such as ICAT which supports JPDA and its new functionality.